<?php



namespace App\Http\Requests\ApiV2;

use Carbon\Carbon;
use Illuminate\Support\Facades\Auth;

class ProblemRequest extends BaseRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'title' => 'required|max:120',

        ];
    }

    public function messages()
    {
        return [
            'title.required' => __('请输入问题的标题'),

        ];
    }

    public function filldata()
    {
        return [
            'user_id'=>Auth::id(),
            'title' =>(string) $this->input('title', ''),
            'content' => (string)$this->input('content', ''),
            'tags'=>(array)$this->input('tags'),
            'is_willing_pay'=>(array)$this->input('is_willing_pay',0),
            'attaches' => (array)$this->input('attaches',[]),
            'record_ids' => (array)$this->input('record_ids',[]),
        ];
    }
}
